﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;

using Fuse8.DomainFramework.Domain;

namespace Fuse8.DomainFramework.DataAccess.SqlDatabase
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    /// <typeparam name="TKey"></typeparam>
    public interface ISqlEntityDataMapper<TEntity, TKey>
        where TEntity : class, IEntityObject<TKey>
        where TKey : IComparable<TKey>, IEquatable<TKey>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sp"></param>
        /// <param name="reader"></param>
        /// <returns></returns>
        TEntity MapFrom(string sp, SqlDataReader reader);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sp"></param>
        /// <param name="reader"></param>
        /// <param name="stepEntity"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        TEntity MapFromMulti(string sp, SqlDataReader reader, TEntity stepEntity, int index);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sp"></param>
        /// <param name="parameter"></param>
        /// <param name="isForCreate"></param>
        /// <returns></returns>
        IList<SqlParameter> MapTo(string sp, object parameter, bool isForCreate);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sp"></param>
        /// <param name="entity"></param>
        /// <param name="values"></param>
        void MapFrom(string sp, TEntity entity, Dictionary<string, object> values);
    }
}
